﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using System.Web.Routing;

namespace ViewDataBusiness
{
    public enum ParameterType { Value = 0, PostGet = 1, Post = 2, Get = 3 }
    public enum OperationType { ExecuteNonQuery = 0, ExecuteScalarNull = 1, ExecuteScalar = 2, FillData = 3, ImageList = 4, FileList = 5, UpFile = 6, UpImage = 7, RenameFile = 8, DeleteFile = 9, DownFile = 10, DeleteImage = 11, RemoveCache = 12 }

    public class QueryParameter
    {
        public ParameterType ParameterType;
        public string Name;
        public string Value;
    }

    public class Query
    {
        public string QueryString;
        public string CountQuery;
        public string Tablename;
        public CommandType CommandType = CommandType.Text;
        public List<QueryParameter> Parameters;
    }

    public class Operation
    {                               
        public OperationType OperationType;
        public string Permission;
        public string JsonParameter;
        public bool Asynchronous;
        public Query Query;
        public object OperationData;
        public int RecordCount;
        public int StartRecord;
        public int MaxRecord;
    }

    public class ViewSetting
    {
        public string ViewTitle;
        public Dictionary<string, Operation> Operations;
        public string ViewForder;
        public string ViewName;
        public string JsonString;
        public string UserID;
        public string UserName;
        public string Permissions;
        public Dictionary<string, string> KeyList;
        public Dictionary<string, string> GetList;
        public string UrlAction;
        public string UrlUploadify;
        public string UrlReferrer;
        public string UrlDown;
        public string SID;
    }

    public class ActionOperation
    {
        public string OperationKey;
        public Dictionary<string, object> Parameters;
        public string JsonParameter;
    }
}
